#include "mainwindow.h"

#include <QApplication>

#include <QFile>
#include <QTextStream>

#ifdef _WIN32
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
    QString logFile = QCoreApplication::applicationDirPath() + "/log.txt";
    QFile outFile(logFile);
    outFile.open(QIODevice::WriteOnly | QIODevice::Append);
    QTextStream ts(&outFile);
    ts << msg << "\n";
}
#endif

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
#ifdef _WIN32
    qInstallMessageHandler(myMessageOutput);
#endif
    FolderUtilities::SetHomeFolder(QApplication::applicationDirPath().toStdString());

    MainWindow w;
    w.show();

    return a.exec();
}